﻿namespace Devonline.Entity;

/// <summary>
/// 职员
/// </summary>
[Table("staff"), DisplayName("职员")]
public class Staff : Staff<string>, IEntitySetWithCreate, IEntitySetWithCreateAndUpdate
{
    /// <summary>
    /// 单位
    /// </summary>
    public virtual Organization? Organization { get; set; }
    /// <summary>
    /// 人员
    /// </summary>
    public virtual Personal? Personal { get; set; }
}

/// <summary>
/// 职员, 即为单位人员, 数据关系为: organization personals
/// </summary>
[Table("staff"), DisplayName("职员")]
public abstract class Staff<TKey> : EntitySetWithCreateAndUpdate<TKey>, IEntitySetWithCreate<TKey>, IEntitySetWithCreateAndUpdate<TKey> where TKey : IConvertible
{
    /// <summary>
    /// 单位编号
    /// </summary>
    [Column("organization_id"), DisplayName("单位编号"), Required, MaxLength(36), Excel]
    public virtual TKey OrganizationId { get; set; } = default!;
    /// <summary>
    /// 人员编号
    /// </summary>
    [Column("personal_id"), DisplayName("人员编号"), Required, MaxLength(36), Excel]
    public virtual TKey PersonalId { get; set; } = default!;
    /// <summary>
    /// 工号
    /// </summary>
    [Column("code"), DisplayName("工号"), MaxLength(36), Excel]
    public virtual string Code { get; set; } = null!;
    /// <summary>
    /// 职位
    /// </summary>
    [Column("position"), DisplayName("职位"), MaxLength(128), Excel]
    public virtual string? Position { get; set; }
    /// <summary>
    /// 入职时间
    /// </summary>
    [Column("join_time"), DisplayName("入职时间"), Excel]
    public virtual DateTime? JoinTime { get; set; }
}